<?php
require_once APP_PATH . '/category/model.php';

/**
 * 显示category页面
 * @param  string
 * @return [type]
 */
function category_quick_create_action() {
	checkLogin();
	$category_name = isset($_POST['category_name']) ? trim($_POST['category_name']) : '';

	if (!empty($category_name)) {
		$category_alias = get_pinyin($category_name);
		//获取数据
		$category_id = category_model_insert($category_name, $category_alias);
		//输出
		if ($category_id) {
			echo "<option value='" . $category_id . "'>" . $category_name . "</option>";
		} else {
			echo '0';
		}
	} else {
		echo '1';
	}

}